package main

import (
	"os"
	"runtime"
	"runtime/pprof"
)

func main3() {
	// 堆内存分配采样
	f, err := os.Create("./pprof_demo/heap.pprof")
	if err != nil {
		panic(err)
	}
	defer f.Close()

	runtime.GC()
	// 业务逻辑
	//expensiveMem()

	if err := pprof.WriteHeapProfile(f); err != nil {
		panic(err)
	}
}
